/*
 * 
 */
package com.c2soft.nepalcmx.util;

import java.util.HashMap;
import java.util.Map;

import com.google.gson.Gson;
import com.c2soft.nepalcmx.command.*;


/**
 * The Class JsonUtil.
 */
public class JsonUtil {

	/**
	 * To json.
	 * 
	 * @param obj
	 *            the obj
	 * @return the string
	 */
	public static String toJson(Object obj) {
		Gson gson = new Gson();

		return gson.toJson(obj);
	}

	/**
	 * From json.
	 *
	 * @param json the json
	 * @return the order command
	 */
	public static Object fromJson(String json,Class _class) {
		Gson gson = new Gson();

		Object object = gson.fromJson(json, _class);

		return object;
	}

	/**
	 * The main method.
	 *
	 * @param args the arguments
	 */
	public static void main(String[] args) {
		Map<String, String> bankDtlMap = new HashMap<String, String>();
		bankDtlMap.put("acc", "000000000000000");
		bankDtlMap.put("bank", "State Bank of India");
		String jsonString = toJson(bankDtlMap);
		System.out.println(jsonString);
		Map<String, String> clientDtlMap = new HashMap<String, String>();
		clientDtlMap.put("cid", "00000");
		clientDtlMap.put("cname", "Pankaj Kumar Sharma");
		clientDtlMap.put("mobile", "9874563210");
		String jsonString1 = toJson(clientDtlMap);
		System.out.println(jsonString1);
		Map<String, String> brokDtlMap = new HashMap<String, String>();
		brokDtlMap.put("range", "01-JAN-2000-31-DEC-2050");
		brokDtlMap.put("sym", "null");
		brokDtlMap.put("btype", "NN");
		brokDtlMap.put("method", "Value");
		brokDtlMap.put("fixb", "0.0000");
		brokDtlMap.put("min", "0.0000");
		brokDtlMap.put("expb", "0.0000");
		brokDtlMap.put("sidef", "null");
		String jsonString2 = toJson(brokDtlMap);
		System.out.println(jsonString2);
		Map<String, String> detailDtlMap = new HashMap<String, String>();
		detailDtlMap.put("cname", "Pankaj Kumar Sharma");
		detailDtlMap.put("pan", "CFQPS243E");
		detailDtlMap.put("add", "1234 D Lucknow");
		detailDtlMap.put("ctcl", "null");
		detailDtlMap.put("add1", "SGFERWSGERHSH");
		detailDtlMap.put("add2", "SGFERWSGERHSH");
		detailDtlMap.put("tradesc", "00000");
		detailDtlMap.put("add3", "SGFERWSGERHSH");
		detailDtlMap.put("email", "pankaj@18pixels.in");
		detailDtlMap.put("groupc", "null");
		detailDtlMap.put("phone", "9876543210");
		detailDtlMap.put("opend", "03-AUG-2013");
		detailDtlMap.put("brokid", "null");
		detailDtlMap.put("contype", "Digital");
		detailDtlMap.put("introducer", "0000000000");
		detailDtlMap.put("lst", "null");
		detailDtlMap.put("cst", "null");
		detailDtlMap.put("cashm", "CMP000");
		detailDtlMap.put("dailym", "MMP000");
		detailDtlMap.put("daily", "DMP000");
		detailDtlMap.put("dmp", "Y");
		detailDtlMap.put("sda", "C");
		detailDtlMap.put("tfa", "C");
		detailDtlMap.put("rma", "null");
		detailDtlMap.put("sttf", "C");
		String jsonString3 = toJson(detailDtlMap);
		System.out.println(jsonString3);
		Map<String, String> clientfundviewDtlMap = new HashMap<String, String>();
		clientfundviewDtlMap.put("id", "C0000");
		clientfundviewDtlMap.put("cname", "Pankaj Kumar Sharma");
		clientfundviewDtlMap.put("mobile", "9876543210");
		clientfundviewDtlMap.put("closeb", "100000");
		clientfundviewDtlMap.put("totm", "500000");
		clientfundviewDtlMap.put("depf", "20000");
		clientfundviewDtlMap.put("utim", "100000");
		clientfundviewDtlMap.put("withf", "10000");
		clientfundviewDtlMap.put("netp", "5000");
		clientfundviewDtlMap.put("balm", "400000");
		clientfundviewDtlMap.put("tot", "115000");
		String jsonString4 = toJson(clientfundviewDtlMap);
		System.out.println(jsonString4);

	}

}
